Initializing
Liveweave
Web
expand_more
home
Home
data_object
CSS Explorer
arrow_outward
Palette
Color Explorer
arrow_outward
Polyline
Graphics Editor
arrow_outward
outbox_alt
Generative AI
arrow_outward
frame_source
Python Playground
New
arrow_outward
build
Tools
expand_more
restart_alt
Load "Hello Weaver!"
post_add
Generate Lorem ipsum...
code
Format HTML
code_blocks
Format CSS
data_object
Format JavaScript
library_add
Library
expand_more
A
Algolia JS
Animate CSS
Apex Charts JS
B
Bulma CSS
Bootstrap
C
Chart JS
Chartist
Create JS
D
D3
Dojo
F
Foundation
Fullpage JS
G
Granim JS
Google Charts
H
Halfmoon
J
jQuery
M
Materialize
Moment JS
Masonry JS
Milligram CSS
P
Pure CSS
Primer CSS
Popper JS
Pattern CSS
Picnic CSS
R
React JS
Raphael JS
Raisin CSS
S
Semantic UI
Skeleton CSS
Spectre CSS
Tachyons CSS
T
Tailwind
Three JS
U
UI Kit
Vis JS
W
Water CSS
download
Download
expand_more
developer_mode
Download as HTML
folder_zip
Download as .ZIP
cloud_upload
Save
account_circle
Login
settings
Settings
expand_more
14
px
Live mode
Night mode
Line number
Mini map
Word wrap
sync_alt
Reset Settings
smart_display
Run
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.js"></script> <script src="http://fabricjs.com/lib/fabric.js"></script> <canvas id="canvas" width="320" height="256"> </canvas> <span id="rotate">Rotate</span><br/> <span id="rotate2">Rotate2</span>
#wrapper{ margin: 0 auto; width: 100%; border: 1px solid #999; padding: 5px; overflow: hidden; } #content{ float:left; } #image-list{ margin: 0px; padding: 0px; float:right; width:150px; } #image-list li{ list-style: none; overflow: hidden; margin-bottom: 10px; border: 2px dashed #000; cursor:move; } .draggable-image{ width: 150px; max-height: 175px; float:left; } #deleteall,#deleteactive{ cursor:pointer; } #canvas-drop-area{ display:none; position: absolute; top:14px; width:320px; height:256px; background:transparent; } #canvas-drop-area.active{ display:block; border: 1px solid red; } #canvas-drop-area1{ display:none; position: absolute; top:256px; width:320px; height:256px; background:transparent; } #canvas-drop-area1.active{ display:block; border: 1px solid green; } #canvas{ width:320px; height:256px; overflow:hidden; float:left; border:1px solid #000000; } #canvas1{ width:320px; height:256px; overflow:hidden; float:left; border:1px solid #000000; }
(function () { var canvas = new fabric.Canvas('canvas'); fabric.Image.fromURL('http://www.gettyimages.com/CMS/Pages/ImageCollection/StaticContent/image1_%20164248809.jpg', function (img) { var img1 = img.set({ left: 0, top: 0 }); fabric.Image.fromURL('http://upload.wikimedia.org/wikipedia/commons/c/c3/Aurora_as_seen_by_IMAGE.PNG', function (img) { var img2 = img.set({ left: 0, top: 0 }); group = new fabric.Group([img1, img2], { left: 0, top: 0, originX: 'center', originY: 'center' }); canvas.add(group); group.center(); //group.hasRotatingPoint=true; //group.lockMovementX = group.lockMovementY = true; group.lockUniScaling = true; group.hasBorders = group.hasControls= false; //group.selectable = false; canvas.renderAll(); }); }); $('#rotate').on({ 'mousedown touchstart click': function () { var x=setInterval(function () {group.setAngle(group.getAngle()+30);canvas.renderAll();}, 3000); return false; }, 'mouseup touchend': function () { clearInterval(x); } }); $('#rotate2').click(function() { group.setAngle(group.getAngle()+30); canvas.renderAll(); }); })();