-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathScaleBitmap.html
33 lines (28 loc) · 963 Bytes
/
ScaleBitmap.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<head>
<title>EaselJS Example: ScaleBitmap</title>
<script type="text/javascript" src="../../lib/easeljs-NEXT.js"></script>
<script type="text/javascript" src="ScaleBitmap.js"></script>
<script>
var stage, text;
function init() {
stage = new createjs.Stage("testCanvas");
var image = new Image();
image.onload = function() { stage.update(); }
image.src = "ScaleBitmapImage.png";
var sb = new createjs.ScaleBitmap(image, new createjs.Rectangle(12, 12, 5, 10));
sb.setDrawSize(200, 300);
stage.addChild(sb);
stage.on("stagemousedown", function(e) {
sb.setDrawSize(Math.random() * 300 + 100 | 0, Math.random() * 100 + 60 | 0);
stage.update();
});
}
</script>
</head>
<body onload="init()">
<p>Click the stage to re-scale the ScaleBitmap.</p>
<canvas id="testCanvas" width="960" height="400"></canvas>
</body>
</html>