Skip to content

Commit 23abc2f

Browse files
committed
add the loading label to ex3
1 parent c3c2a1d commit 23abc2f

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

public/ex3/index.js

+23
Original file line numberDiff line numberDiff line change
@@ -64019,6 +64019,11 @@ var JSceneKitExample =
6401964019
_this._scaleNode = new _jscenekit.SKNode();
6402064020
_this._collectedItemsCount = 0;
6402164021
_this._collectedItemsCountLabel = _jscenekit.SKLabelNode.labelWithFontNamed('Superclarendon');
64022+
64023+
_this._loadingScene = new _jscenekit.SKScene();
64024+
_this._gameScene = new _jscenekit.SKScene();
64025+
64026+
_this.setLoadingScene();
6402264027
return _this;
6402364028
}
6402464029

@@ -64049,6 +64054,24 @@ var JSceneKitExample =
6404964054
_get(View.prototype.__proto__ || Object.getPrototypeOf(View.prototype), 'setFrameSize', this).call(this, newSize);
6405064055
this.update2DOverlays();
6405164056
}
64057+
}, {
64058+
key: 'setLoadingScene',
64059+
value: function setLoadingScene() {
64060+
this._loadingScene.scaleMode = _jscenekit.SKSceneScaleMode.resizeFill;
64061+
this._loadingScene.backgroundColor = _jscenekit.SKColor.white;
64062+
64063+
var loadingText = new _jscenekit.SKLabelNode();
64064+
loadingText.text = 'Loading...';
64065+
loadingText.fontColor = _jscenekit.SKColor.black;
64066+
loadingText.position = new _jscenekit.CGPoint(100, 100);
64067+
64068+
var fadeAction = _jscenekit.SKAction.repeatForever(_jscenekit.SKAction.sequence([_jscenekit.SKAction.fadeOutWithDuration(0.5), _jscenekit.SKAction.fadeInWithDuration(0.5)]));
64069+
loadingText.run(fadeAction);
64070+
64071+
this._loadingScene.addChild(loadingText);
64072+
64073+
this.overlaySKScene = this._loadingScene;
64074+
}
6405264075

6405364076
// MARK: Overlays
6405464077

src/ex3/js/View.js

+29
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
CGPoint,
55
CGSize,
66
SCNView,
7+
SKAction,
8+
SKColor,
79
SKLabelHorizontalAlignmentMode,
810
SKLabelNode,
911
SKNode,
@@ -22,6 +24,11 @@ export default class View extends SCNView {
2224
this._scaleNode = new SKNode()
2325
this._collectedItemsCount = 0
2426
this._collectedItemsCountLabel = SKLabelNode.labelWithFontNamed('Superclarendon')
27+
28+
this._loadingScene = new SKScene()
29+
this._gameScene = new SKScene()
30+
31+
this.setLoadingScene()
2532
}
2633

2734
// MARK: Mouse and Keyboard Events
@@ -47,6 +54,28 @@ export default class View extends SCNView {
4754
this.update2DOverlays()
4855
}
4956

57+
setLoadingScene() {
58+
this._loadingScene.scaleMode = SKSceneScaleMode.resizeFill
59+
this._loadingScene.backgroundColor = SKColor.white
60+
61+
const loadingText = new SKLabelNode()
62+
loadingText.text = 'Loading...'
63+
loadingText.fontColor = SKColor.black
64+
loadingText.position = new CGPoint(100, 100)
65+
66+
const fadeAction = SKAction.repeatForever(
67+
SKAction.sequence([
68+
SKAction.fadeOutWithDuration(0.5),
69+
SKAction.fadeInWithDuration(0.5)
70+
])
71+
)
72+
loadingText.run(fadeAction)
73+
74+
this._loadingScene.addChild(loadingText)
75+
76+
this.overlaySKScene = this._loadingScene
77+
}
78+
5079
// MARK: Overlays
5180

5281
update2DOverlays() {

0 commit comments

Comments
 (0)