I'm trying to implement a custom buffer screen for my RAF implementation. I'm placing an image of a spinner on the screen and using the "setAdBufferRenderCallback" method to update the TargetRotation of my spinner. When printing out the value i can see it update as expected but the spinner doesn't actually rotate. Even setting the default TargetRotation value doesn't seem to do anything? This same logic was implemented using roImageCanvas in our non-SceneGraph app and it worked fine. Any ideas why it now wouldn't work?
Here is my code
function setupBufferScreen(adIface)
displaySize = CreateObject("roDeviceInfo").getDisplaySize()
cW = displaySize.w
cH = displaySize.h
bg = getSpinnerBG(cW, cH)
spinner = getSpinnerLayer(cW, cH)
adIface.setAdBufferScreenLayer(0, bg)
adIface.setAdBufferScreenLayer(1, spinner)
adIface.setAdBufferRenderCallback(bufferScreenCallback, {}, 0)
end function
function bufferScreenCallback(state as Dynamic, eventType as String, ctx as Dynamic)
if eventType = "Progress"
ctx.canvasLayers[1].TargetRotation = ctx.progress
? "TARGET ROTATION: "; ctx.canvasLayers[1].TargetRotation
end if
end function
function getSpinnerBG(cW, cH)
spinnerBGSize = 125
spinnerBGLayout = {
x : Int((cW / 2) - (spinnerBGSize / 2))
y : Int((cH / 2) - (spinnerBGSize / 2))
w : spinnerBGSize
h : spinnerBGSize
}
return {
Color: "#101010"
CompositionMode: "Source"
TargetRect: spinnerBGLayout
}
end function
function getSpinnerLayer(cW, cH)
spinnerSize = 100
spinnerX = Int((cW / 2) - (spinnerSize / 2))
spinnerY = Int((cH / 2) - (spinnerSize / 2))
spinnerTargetRect = {
x: spinnerX,
y: spinnerY,
w: spinnerSize,
h: spinnerSize
}
return {
url: "pkg://images/spinner.png",
TargetRect: spinnerTargetRect,
TargetTranslation: { x: spinnerX, y: spinnerY },
TargetRotation: 90,
CompositionMode: "Source"
}
end function
Here is the output in the console:
rafrndr-renderTypeChanged() - client-inserted
added child: Rectangle id: 1 subtype: Rectangle
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 0
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 6
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 13
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 19
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 26
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 33
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 6
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 13
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 19
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 26
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 33
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 33
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 99
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 99
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
TARGET ROTATION: 100
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true
added child: Rectangle id: 0 subtype: Rectangle
added child: Poster id: 1 subtype: Poster
check layer: 1 visible: true
check layer: 0 visible: true