未验证 提交 33ada1b0 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #20547 from Mugen87/dev51

Editor: Make playback speed of animations configurable.
import { UIPanel, UIDiv, UIBreak, UISelect, UIButton, UIText } from './libs/ui.js';
import { UIPanel, UIBreak, UISelect, UIButton, UIText, UINumber, UIRow } from './libs/ui.js';
function SidebarAnimation( editor ) {
......@@ -30,6 +30,7 @@ function SidebarAnimation( editor ) {
animationsSelect.setOptions( options );
animationsSelect.setValue( firstAnimation );
mixerTimeScaleNumber.setValue( mixer.timeScale );
} else {
......@@ -63,6 +64,12 @@ function SidebarAnimation( editor ) {
}
function changeTimeScale() {
mixer.timeScale = mixerTimeScaleNumber.getValue();
}
var container = new UIPanel();
container.setDisplay( 'none' );
......@@ -70,13 +77,26 @@ function SidebarAnimation( editor ) {
container.add( new UIBreak() );
container.add( new UIBreak() );
var div = new UIDiv();
container.add( div );
//
var animationsRow = new UIRow();
var animationsSelect = new UISelect().setFontSize( '12px' );
div.add( animationsSelect );
div.add( new UIButton( strings.getKey( 'sidebar/animations/play' ) ).setMarginLeft( '4px' ).onClick( playAction ) );
div.add( new UIButton( strings.getKey( 'sidebar/animations/stop' ) ).setMarginLeft( '4px' ).onClick( stopAction ) );
animationsRow.add( animationsSelect );
animationsRow.add( new UIButton( strings.getKey( 'sidebar/animations/play' ) ).setMarginLeft( '4px' ).onClick( playAction ) );
animationsRow.add( new UIButton( strings.getKey( 'sidebar/animations/stop' ) ).setMarginLeft( '4px' ).onClick( stopAction ) );
container.add( animationsRow );
//
var mixerTimeScaleRow = new UIRow();
var mixerTimeScaleNumber = new UINumber( 0.5 ).setWidth( '60px' ).setRange( - 10, 10 ).onChange( changeTimeScale );
mixerTimeScaleRow.add( new UIText( strings.getKey( 'sidebar/animations/timescale' ) ).setWidth( '90px' ) );
mixerTimeScaleRow.add( mixerTimeScaleNumber );
container.add( mixerTimeScaleRow );
return container;
......
......@@ -77,6 +77,7 @@ function Strings( config ) {
'sidebar/animations': 'Animations',
'sidebar/animations/play': 'Play',
'sidebar/animations/stop': 'Stop',
'sidebar/animations/timescale': 'Time Scale',
'sidebar/scene': 'Scene',
'sidebar/scene/background': 'Background',
......@@ -400,6 +401,7 @@ function Strings( config ) {
'sidebar/animations': 'Animations',
'sidebar/animations/play': 'Play',
'sidebar/animations/stop': 'Stop',
'sidebar/animations/timescale': 'Time Scale',
'sidebar/scene': 'Scène',
'sidebar/scene/background': 'Arrière Plan',
......@@ -723,6 +725,7 @@ function Strings( config ) {
'sidebar/animations': '动画',
'sidebar/animations/play': '播放',
'sidebar/animations/stop': '暂停',
'sidebar/animations/timescale': 'Time Scale',
'sidebar/scene': '场景',
'sidebar/scene/background': '背景',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册