2011-06-30 21:20:09 -04:00
|
|
|
<!DOCTYPE html>
|
2011-03-06 07:08:24 -05:00
|
|
|
<html>
|
|
|
|
<head>
|
2014-08-16 13:24:54 -04:00
|
|
|
<meta charset="UTF-8">
|
|
|
|
<title>Raster</title>
|
|
|
|
<link rel="stylesheet" href="../css/style.css">
|
|
|
|
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
|
|
|
<script type="text/paperscript" canvas="canvas">
|
|
|
|
// Load from Server:
|
2015-05-31 04:50:04 -04:00
|
|
|
var raster = new Raster('http://assets.paperjs.org/images/marilyn.jpg');
|
2014-08-16 13:24:54 -04:00
|
|
|
// Load from DOM image:
|
2015-05-31 04:50:04 -04:00
|
|
|
// var raster = new Raster('marilyn');
|
2014-08-16 13:24:54 -04:00
|
|
|
raster.onLoad = function() {
|
|
|
|
console.log('Successfully loaded image!');
|
|
|
|
};
|
|
|
|
var lastScale = 1;
|
|
|
|
var center = view.center;
|
|
|
|
function onFrame(event) {
|
|
|
|
var scale = (Math.sin(event.time * 2) + 1) / 2;
|
|
|
|
raster.scale(scale / lastScale);
|
|
|
|
lastScale = scale;
|
2016-01-26 15:06:36 -05:00
|
|
|
raster.position = center + [
|
|
|
|
Math.sin(event.time * 3) * 256,
|
|
|
|
Math.sin(event.time * 2.5) * 256
|
|
|
|
];
|
2014-08-16 13:24:54 -04:00
|
|
|
raster.rotate(event.delta * 120);
|
|
|
|
}
|
|
|
|
</script>
|
2011-03-06 07:08:24 -05:00
|
|
|
</head>
|
|
|
|
<body>
|
2014-08-16 13:24:54 -04:00
|
|
|
<canvas id="canvas" resize></canvas>
|
2015-05-31 04:50:04 -04:00
|
|
|
<img id="marilyn" width="512" height="512" style="display: none;" src="data:image/jpg;base64,/9j/4QCMRXhpZgAASUkqAAgAAAABAJiCAgBoAAAAGgAAAAAAAAAoYykgVGhlIEFuZHkgV2FyaG9sIEZvdW5kYXRpb24gZm9yIHRoZSBWaXN1YWwgQXJ0cywgSW5jLi9BUlMsIE5ZI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