html Processing.js
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html Processing.js相关的知识,希望对你有一定的参考价值。
body {
background: #eee;
}
$ ->
console.log 'processing code is in html'
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>$title</title>
$styles
</head>
<body>
<h1>$title</h1>
<canvas id="mycanvas"></canvas>
<script src="$ext/processing-1.3.6.min.js"></script>
<script type="text/processing" data-processing-target="mycanvas">
int x = 20;
int y = 20;
int w = 300;
int h = 200;
int speed = 3;
int vx = speed;
int vy = speed;
void setup()
{
size(w,h);
fill(255);
PFont fontA = loadFont("courier");
textFont(fontA, 14);
println("Hello ErrorLog!");
}
void draw(){
background(125);
text("Hello Web!",20,20);
x += vx;
y += vy;
if (x < 0) vx = speed;
if (x > w) vx = -speed;
if (y < 0) vy = speed;
if (y > h) vy = -speed;
ellipse(x, y, 10, 10);
}
</script>
$scripts
</body>
</html>
以上是关于html Processing.js的主要内容,如果未能解决你的问题,请参考以下文章
世界上最短的时钟代码!更短的,有木有?
带有 HTML 5 画布的 Sprite-Sheet BLIT?
55种开源数据可视化工具简介
为啥 WKWebView 无法运行 processingjs 脚本?
一天学会HTML 基础
Html.Partial 与 Html.RenderPartial 和 Html.Action 与 Html.RenderAction