samedi 21 septembre 2019

rotations

<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Demo</title>

<style>
html,body{
height:100%;
margin:0;
}
body{
overflow:hidden;
}
#svg1{
width:100%;
height:100%;
}
#div1{
position:absolute;
top:0;
left:0;
font-family:sans-serif;
font-size:8px;
}
</style>

<body>
<div id="div1"></div>
<svg id="svg1">
</svg>

<script>
var ww=Math.round(window.innerWidth);
var wh=Math.round(window.innerHeight);
var svg1=document.getElementById("svg1");
var div1=document.getElementById("div1");
var i;

ww=Math.round(window.innerWidth);
wh=Math.round(window.innerHeight);
div1.innerHTML="window size : "+ww+" x "+wh;

for(i=0;i<Math.round(ww/20);i++){
var c=document.createElementNS(svg1.namespaceURI,"circle");
c.setAttributeNS(null,"cx",Math.round(ww/2)+(i*10));
c.setAttributeNS(null,"cy",Math.round(wh/2));
c.setAttributeNS(null,"r",10);
c.setAttributeNS(null,"fill","#"+Math.round(0xFFFFFF * Math.random()).toString(16));
c.setAttributeNS(null,"id","c"+i);

var a=document.createElementNS(svg1.namespaceURI,"animateTransform");
a.setAttributeNS(null,"attributeName","transform");
a.setAttributeNS(null,"attributeType","xml");
a.setAttributeNS(null,"type","rotate");
a.setAttributeNS(null,"values","0 "+Math.round(ww/2)+" "+Math.round(wh/2)+";360 "+Math.round(ww/2)+" "+Math.round(wh/2));
a.setAttributeNS(null,"dur",(100-i)+"s");
a.setAttributeNS(null,"repeatCount","indefinite");

svg1.appendChild(c);
c.appendChild(a);
}

</script>
</body>
</head>
</html>

mercredi 18 septembre 2019

Tryout

rot.

vendredi 13 septembre 2019

Demo

rot.

spinning squares

<!doctype html>
<html lang="fr">

<head>
<meta charset="utf-8">
<title>rot.</title>
<style>
html,body{
height:100%;
margin:0;
}
body{
font-family:sans-serif;
overflow:hidden;
}
#div1{
font-size:6px;
position:absolute;
top:0;
left:0;
-moz-user-select:none;
user-select:none;
}
#svg1{
width:100%;
height:100%;
}
</style>
</head>

<body>

<svg id="svg1"></svg>
<div id="div1"></div>

<script>
var ww=window.innerWidth;
var wh=window.innerHeight;
var div1=document.getElementById("div1");
var svg1=document.getElementById("svg1");
var j=250;

var r0=document.createElementNS(svg1.namespaceURI,"rect");
r0.setAttributeNS(null,"x",0);
r0.setAttributeNS(null,"y",0);
r0.setAttributeNS(null,"width",ww);
r0.setAttributeNS(null,"height",wh);
r0.setAttributeNS(null,"fill","#"+Math.round(0xFFFFFF * Math.random()).toString(16));
r0.setAttributeNS(null,"id","fond");

svg1.appendChild(r0);

for(i=1;i<=100;i++){
var d1=Math.round(Math.random()*20);
var d2=Math.round(Math.random()*20);
var g1=document.createElementNS(svg1.namespaceURI,"g");

var r1=document.createElementNS(svg1.namespaceURI,"rect");
r1.setAttributeNS(null,"x",ww/2-(ww/i)/2);
r1.setAttributeNS(null,"y",wh/2-(ww/i)/2);
r1.setAttributeNS(null,"width",ww/i);
r1.setAttributeNS(null,"height",ww/i);
r1.setAttributeNS(null,"fill","#"+Math.round(0xFFFFFF * Math.random()).toString(16));
r1.setAttributeNS(null,"id","rect"+i);

var a1=document.createElementNS(svg1.namespaceURI,"animateTransform");
a1.setAttribute("attributeName","transform");
a1.setAttribute("attributeType","xml");
a1.setAttribute("type", "rotate");
a1.setAttribute("begin", "0s");
a1.setAttribute("values","0 "+ww/2+" "+wh/2+";360 "+ww/2+" "+wh/2);
a1.setAttribute("dur",d1);
a1.setAttribute("repeatCount","indefinite");

svg1.appendChild(g1);
g1.appendChild(r1);
g1.appendChild(a1);
div1.innerHTML+=i+" ";
}

</script>
</body>

</html>

mardi 3 septembre 2019

Petits carrés bleus

puzzle

mercredi 10 juillet 2019

4r4chn33

<!doctype html>
<html lang="fr">

<head>
<meta charset="utf-8">
<title>game</title>
<style>
html,body{
height:100%;
margin:0;
}
body{
font-family:sans-serif;
overflow:hidden;
}
#div1{
position:absolute;
bottom:0;
left:0;
-moz-user-select:none;
user-select:none;
}
#div2{
position:absolute;
top:0;
right:0;
}
#svg1{
width:100%;
height:100%;
}
</style>
</head>

<body>

<svg id="svg1">
<path d="m0 0L0 0" id="pat1" stroke="#000"/>
<path d="m0 0L0 0" id="pat2" stroke="#000"/>
<path d="m0 0L0 0" id="pat3" stroke="#000"/>
<path d="m0 0L0 0" id="pat4" stroke="#000"/>
<g id="g1"></g></svg>

<div id="div1"></div>
<div id="div2"></div>

<script>
var ww=window.innerWidth;
var wh=window.innerWidth;
var div1=document.getElementById("div1");
var div1=document.getElementById("div1");
var svg1=document.getElementById("svg1");
var mx=0;
var my=0;
var path1;
var pat1=document.getElementById("pat1");
var pat2=document.getElementById("pat2");
var pat3=document.getElementById("pat3");
var pat4=document.getElementById("pat4");
var ncirc=0;
var col1="#000";

function mov(e){
mx=Math.round(e.clientX/10)*10;
my=Math.round(e.clientY/10)*10;
pat1.setAttribute("d","m0 0L"+mx+" "+my);
pat2.setAttribute("d","m"+ww+" 0L"+mx+" "+my);
pat3.setAttribute("d","m0 "+wh+"L"+mx+" "+my);
pat4.setAttribute("d","m"+ww+" "+wh+"L"+mx+" "+my);
}

function stats(){
div1.innerHTML="x: "+mx+"<br>y: "+my+"<br>color: "+col1+"<br>total: "+ncirc;
}

function cli(e){
col1="royalblue";

if(document.getElementById(mx+"_"+my)==null){
path1=document.createElementNS(svg1.namespaceURI,"path");
path1.setAttributeNS(null,"d","m0 0L"+mx+" "+my+"L"+mx+" "+my+" "+ww+" 0L"+ww+" 0 "+ww+" "+wh+"L"+mx+" "+my+"L0 "+wh);
path1.setAttributeNS(null,"stroke",col1);
path1.setAttributeNS(null,"fill","none");

path1.setAttributeNS(null,"id",mx+"_"+my);
g1.appendChild(path1);
ncirc++;}
else{
g1.removeChild(document.getElementById(mx+"_"+my));
nrect--}
}

setInterval(stats,1);
document.body.onmousemove=mov;
document.body.onmousedown=cli;
</script>
</body>

</html>

samedi 22 juin 2019

HB

<svg width="517" height="800">
<defs>
<mask id="half">
<rect width="290" height="800" fill="white"/>
</mask>
</defs>
<image xlink:href="https://i.pinimg.com/originals/e8/38/d3/e838d3d103c637ee3e8597e65d25fcbb.jpg" width="517" height="800"></image>
<text x="200" y="320">Happy Birtday
<animate attributename="x" begin="h.mousedown" dur="6s" fill="freeze" values="200;320"/>
</text>
<image xlink:href="https://i.pinimg.com/originals/e8/38/d3/e838d3d103c637ee3e8597e65d25fcbb.jpg" width="517" height="800" style="mask:url(#half)" id="h"></image>
<a xlink:href="https://gallica.bnf.fr/ark:/12148/bpt6k8820739c/f1.audio" target="blank">
<circle cx="310" cy="180" r="40" opacity="0"></circle>
</a>


</svg>