mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 03:21:19 +00:00
Animation Controls
This commit is contained in:
parent
1a04dd8db3
commit
dfaf752d73
@ -30,7 +30,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<item row="0" column="1">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
@ -56,9 +56,10 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<zorder>speedSlider</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="0" column="4">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
@ -212,6 +213,45 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="speedSlider">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="play_button">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> ⏯</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
|
||||
@ -888,10 +888,6 @@ void Viewer::animate(){
|
||||
update();
|
||||
}
|
||||
|
||||
void Viewer::startAniumation(){}
|
||||
|
||||
void Viewer::stopAnimation(){}
|
||||
|
||||
void Viewer::rotateSelectedObjXCCW() {
|
||||
rotateSelected(RotateDirection::X_CCW);
|
||||
}
|
||||
@ -911,6 +907,10 @@ void Viewer::rotateSelectedObjZCW() {
|
||||
rotateSelected(RotateDirection::Z_CW);
|
||||
}
|
||||
|
||||
void Viewer::animationSpeedChange(int val) {
|
||||
frame_mult = fmax(double(val) / 10, 0.05);
|
||||
}
|
||||
|
||||
void Viewer::rotateSelected(RotateDirection dir) {
|
||||
if(selectedObj.shape == nullptr || selectedObj.shape->getParent() == nullptr) return;
|
||||
|
||||
|
||||
@ -81,6 +81,7 @@ public slots:
|
||||
void rotateSelectedObjYCW();
|
||||
void rotateSelectedObjZCCW();
|
||||
void rotateSelectedObjZCW();
|
||||
void animationSpeedChange(int);
|
||||
|
||||
signals:
|
||||
int shapeSelected(int);
|
||||
@ -107,8 +108,8 @@ private:
|
||||
PickedGeom pickGeom(int, int);
|
||||
|
||||
void animate();
|
||||
void startAniumation();
|
||||
void stopAnimation();
|
||||
// void startAnimation();
|
||||
// void stopAnimation();
|
||||
|
||||
void drawUi();
|
||||
|
||||
|
||||
@ -75,6 +75,10 @@ void MainWindow::addViewer(Viewer* viewer)
|
||||
connect(ui->cw_y, SIGNAL(clicked(bool)), viewer, SLOT(rotateSelectedObjYCW()));
|
||||
connect(ui->ccw_z, SIGNAL(clicked(bool)), viewer, SLOT(rotateSelectedObjZCCW()));
|
||||
connect(ui->cw_z, SIGNAL(clicked(bool)), viewer, SLOT(rotateSelectedObjZCW()));
|
||||
|
||||
connect(ui->speedSlider, SIGNAL(valueChanged(int)), viewer, SLOT(animationSpeedChange(int)));
|
||||
connect(ui->play_button, SIGNAL(clicked(bool)), viewer, SLOT(toggleAnimation()));
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::onColorPickerActivate(){
|
||||
|
||||
@ -23,6 +23,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void onColorPickerActivate();
|
||||
// void onToggleAnimationText();
|
||||
//void onTextureToggle();
|
||||
|
||||
private:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user