Files
@ 69ca2b2fc133
Branch filter:
Location: light9/web/timeline2/index.html
69ca2b2fc133
3.5 KiB
text/html
overcomplicated attempt at persisting the pane layout in the rdf graph
this was hard because we have to somehow wait for the graph to load before config'ing the panes
this was hard because we have to somehow wait for the graph to load before config'ing the panes
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | <!DOCTYPE HTML>
<html>
<head>
<title>pixi.js test</title>
<style>
body {
margin: 0;
padding: 0;
background-color: #000000;
}
#help{
position: absolute;
z-index: 20;
color: black;
top: 20px;
left: 120px;
}
</style>
<script src="node_modules/pixi.js/dist/pixi.js"></script>
</head>
<body>
<script>
const log = debug('timeline');
var stage = new PIXI.Container();
var renderer = PIXI.autoDetectRenderer(3000,2000, {
backgroundColor: 0x606060,
});
document.body.appendChild(renderer.view);
requestAnimFrame = window.requestAnimationFrame;
requestAnimFrame( animate );
if(1) {
var graphics = new PIXI.Graphics();
// set a fill and line style
graphics.beginFill(0xFF3300);
graphics.lineStyle(4, 0xffd900, 1);
graphics.blendMode = PIXI.BLEND_MODES.LUMINOSITY;
graphics.cursor = 'wait';
// draw a shape
graphics.moveTo(50,50);
graphics.lineTo(250, 50);
graphics.lineTo(100, 100);
graphics.lineTo(50, 50);
graphics.endFill();
graphics.interactive = true;
graphics.on('click', (ev) => {
log('hit', ev);
});
stage.addChild(graphics);
}
objs = [];
const mkdrag = (txt, pos) => {
var draggable = new PIXI.Container();
var graphics = new PIXI.Graphics();
graphics.beginFill(0xeecc00, .6);
graphics.lineStyle(2, 0xffd900, 1);
graphics.drawRoundedRect(0,0,50,30,5);
graphics.endFill();
draggable.addChild(graphics);
var style = new PIXI.TextStyle({
fontFamily: 'Arial',
fontSize: 16,
fill: ['#000000'],
});
var basicText = new PIXI.Text(txt, style);
basicText.x = 3;
basicText.y = 9;
basicText.scale = new PIXI.Point(.7,1);
draggable.addChild(basicText);
draggable.interactive = true;
draggable.on('click', (ev) => {
console.log('d hit', ev);
});
draggable.position = pos;
// console.log( draggable.toGlobal(new PIXI.Point(3, 3)));
return draggable;
};
for (let x=0; x<3000; x+=30) {
for(let i=0; i < 400; i+= 20) {
let d = mkdrag('o='+i, new PIXI.Point(i+x, i*2))
stage.addChild(d);
objs.push(d);
}
}
var style = new PIXI.TextStyle({
fontFamily: 'Arial',
fontSize: 36,
fill: ['#ffffff'],
stroke: '#4a1850',
strokeThickness: 2,
dropShadow: true,
dropShadowColor: '#000000',
dropShadowBlur: 1,
dropShadowAngle: Math.PI / 6,
dropShadowDistance: 6,
// wordWrap: true,
// wordWrapWidth: 440
});
var basicText = new PIXI.Text(`num objs = ${objs.length}`, style);
basicText.x = 30;
basicText.y = 90;
stage.addChild(basicText);
function animate() {
requestAnimFrame( animate );
for (let d of objs) {
d.rotation = Date.now() / 2000;
}
renderer.render(stage);
}
renderer.render(stage);
</script>
</body>
</html>
|