Commit e7f21e59 authored by Nikolay Igotti's avatar Nikolay Igotti

Fix samples

parent 0f799c3e
......@@ -10,10 +10,11 @@ import org.w3c.dom.HTMLCanvasElement
fun main() {
onWasmReady {
val paint = Paint()
paint.setColor4f(Color4f(0f, 1f, 0f, 1.0f))
paint.setMode(PaintMode.FILL)
paint.setAntiAlias(true)
val paint = Paint().apply {
color4f = Color4f(0f, 1f, 0f, 1.0f)
mode = PaintMode.FILL
isAntiAlias = true
}
val canvas = document.getElementById("c") as HTMLCanvasElement
canvas.getContext("webgl")
......@@ -34,7 +35,7 @@ fun main() {
fun draw() {
surface.canvas.drawCircle(50f, 50f, 25f, paint)
paint.setColor4f(Color4f(1f, 1f, 0f, 1.0f))
paint.color4f = Color4f(1f, 1f, 0f, 1.0f)
surface.canvas.drawCircle(100f, 100f, 10f, paint)
surface.canvas.drawCircle(200f, 200f, 30f, paint)
window.requestAnimationFrame { draw() }
......
......@@ -49,8 +49,7 @@ class Renderer(
fun displayScene(renderer: Renderer, nanoTime: Long) {
val canvas = renderer.canvas!!
val paint = Paint()
paint.setColor(Color.GREEN)
val paint = Paint().apply { color = Color.GREEN}
canvas.clear(Color.RED)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment