• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

soulwire/sketch.js: Cross-Platform JavaScript Creative Coding Framework

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

soulwire/sketch.js

开源软件地址:

https://github.com/soulwire/sketch.js

开源编程语言:

JavaScript 89.6%

开源软件介绍:

sketch.js

A tiny (~2kb gzipped) platform for JavaScript creative coding.

A few examples from the showcase

Start Coding Faster

sketch.js lets you get straight to the fun parts of creative coding, without ever having to worry about shims or boilerplate code.

It gives you a graphics context, an animation loop, normalised input events and a host of useful callbacks to hook into.

Here's an example:

Sketch.create({
  setup() {
    this.r = this.g = this.b = random(100, 200)
  },
  mousemove() {
    this.r = 255 * (this.mouse.x / this.width)
    this.g = 255 * (this.mouse.y / this.height)
    this.b = 255 * abs(cos(PI * this.mouse.y / this.width))
  },
  draw() {
    this.fillStyle = `rgb(${~~this.r},${~~this.g},${~~this.b})`
    this.fillRect(0, 0, this.width, this.height)
  }
})

See it in action

The Highlights

  • A sketch is an augmented drawing context (CanvasRenderingContext2D, WebGLRenderingContext or HTMLElement) so it has all the expected drawing methods built in.
  • The mouse property is also the first element of the touches array and vice versa, so you can code to one standard and get touch and multi-touch support for free.
  • The update and draw loops run on the browser animation frame and can stop and start whenever you like.
  • You get fast access to Math functions and constants, plus extras like range and array enabled random, map and lerp.
  • Simple and configurable. You can even bring your own context, so it works well with libraries like THREE.

The Rest

For more information, check out the getting started guide, the API, the many examples in the showcase and the full source.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap