完善Demo

This commit is contained in:
caizhitao
2019-12-23 23:12:22 +08:00
parent 6d9bd2c8ce
commit e3905b9c0a
19 changed files with 4609 additions and 2807 deletions

View File

@@ -10,11 +10,11 @@ export default class GlowInnerEffectScene extends cc.Component {
private _examplesParentNode: cc.Node = null;
onLoad() {
this._redSlider = cc.find("Canvas/SliderLayouts/RedSlider/Slider").getComponent(cc.Slider);
this._greenSlider = cc.find("Canvas/SliderLayouts/GreenSlider/Slider").getComponent(cc.Slider);
this._blueSlider = cc.find("Canvas/SliderLayouts/BlueSlider/Slider").getComponent(cc.Slider);
this._alphaSlider = cc.find("Canvas/SliderLayouts/AlphaSlider/Slider").getComponent(cc.Slider);
this._widthSlider = cc.find("Canvas/SliderLayouts/WidthSlider/Slider").getComponent(cc.Slider);
this._redSlider = cc.find("Canvas/SliderLayouts/ColorRedSliderPrefab/Slider").getComponent(cc.Slider);
this._greenSlider = cc.find("Canvas/SliderLayouts/ColorGreenSliderPrefab/Slider").getComponent(cc.Slider);
this._blueSlider = cc.find("Canvas/SliderLayouts/ColorBlueSliderPrefab/Slider").getComponent(cc.Slider);
this._alphaSlider = cc.find("Canvas/SliderLayouts/ColorAlphaSliderPrefab/Slider").getComponent(cc.Slider);
this._widthSlider = cc.find("Canvas/SliderLayouts/GlowWidthSliderPrefab/Slider").getComponent(cc.Slider);
this._examplesParentNode = cc.find("Canvas/Examples");
}
@@ -41,7 +41,7 @@ export default class GlowInnerEffectScene extends cc.Component {
private _onSliderChanged() {
this._updateRenderComponentOutterGlowMaterial({
glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress),
glowColorSize: this._widthSlider.progress / 100
glowColorSize: this._widthSlider.progress * 0.01
});
}

View File

@@ -0,0 +1,7 @@
{
"ver": "1.0.1",
"uuid": "4880429c-1a17-402a-997b-03e40556ce1e",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}

View File

@@ -0,0 +1,7 @@
{
"ver": "1.0.1",
"uuid": "7f773a6d-12c8-4f78-adab-37534100a08e",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}

View File

@@ -0,0 +1,26 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class ColorSliderPrefab extends cc.Component {
@property(cc.Slider)
slider: cc.Slider = null;
@property(cc.Label)
valueLabel: cc.Label = null;
onEnable() {
this.slider.node.on("slide", this._onSliderChanged, this);
}
onDisable() {
this.slider.node.off("slide", this._onSliderChanged, this);
}
start() {
this._onSliderChanged();
}
private _onSliderChanged() {
this.valueLabel.string = `${this.slider.progress.toFixed(2)} | ${Math.round(255 * this.slider.progress)}`;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "7d52782d-b07b-4a2a-b287-c029c5c1f05f",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,27 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class GlowWidthSliderPrefab extends cc.Component {
@property(cc.Slider)
slider: cc.Slider = null;
@property(cc.Label)
valueLabel: cc.Label = null;
onEnable() {
this.slider.node.on("slide", this._onSliderChanged, this);
}
onDisable() {
this.slider.node.off("slide", this._onSliderChanged, this);
}
start() {
this._onSliderChanged();
}
private _onSliderChanged() {
let realProgress = this.slider.progress * 0.01;
this.valueLabel.string = `${(realProgress * 100).toFixed(2)}%`;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "a1622cf4-4ad9-4bb4-a027-b751d2ae0bcd",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}