2-buffered animation

Hey! I'm trying made smt like paint using the canvas-view. How can I draw a circle which is expanding, while user move finger on a screen, without save Image into storage? Also, I wanna show radius (line from center to current x,y)

Already tried to use 2 variables, one for screen state before drawing circles and second - for state with circle.

Alghoritms be like:

  1. in onTouchDown() / or in onTouchUp(), nvm: savedScreen = canvas.Save()
  2. in onDragged()
    canvas.Background = savedScreen
    bufferedScreen = canvas.Save()

Save screen into buffer before drawLine , becouse I dont need it, just line, which represents redius.
How can I made it , without save() method if set canvas.background = get canvas.background gaves me emoty screen , becouse it cant find file with name ${get canvas.background}?

Welcome aDragon.

Perhaps something like:


use two canvas, one overlap another.
when you want to draw circle, draw it on the top one, when finish drawing (touch up), draw it again on lower canvas.
in this way, the already drawn on lower canvas will remains.

you will need a extension for ovetlaping. search overlap in community.

1 Like