Author:masaka
主にプログラム・DTM・イラストをやってます
float base = 10.0f; // 底 float min = logf(freq_min) / logf(base); // 対数における最小 float max = logf(freq_max) / logf(base); // 対数における最大 float freq = powf(base, min + (max - min) * now); // 計算結果 |
float getFreq(float now, float freq_min, float freq_max, float base) { float min = logf(freq_min); float max = logf(freq_max); return powf(base, (min + (max - min) * now) / logf(base)); } |
#include <stdio.h> #include <math.h> float getFreq(float now, float freq_min, float freq_max, float base) { float min = logf(freq_min) / logf(base); float max = logf(freq_max) / logf(base); return powf(base, min + (max - min) * now); } int main(){ float now, result; while (1){ printf("■0.0~1.0の値を入力: "); scanf("%f", &now); if ((now<0.0f) || (now>1.0f)) break; result = getFreq(now, 10.0f, 5000.0f, 10.0f); printf("結果: %.5f\n", result); } return 0; } |
#include <stdio.h> #include <math.h> double getFreq(double now, double freq_min, double freq_max, double base) { double min = log(freq_min); double max = log(freq_max); return pow(base, (min + (max - min) * now) / log(base)); } int main(){ double now, result; while (1){ printf("■0.0~1.0の値を入力: "); scanf("%lf", &now); if ((now<0.0) || (now>1.0)) break; result = getFreq(now, 10.0, 5000.0, 10.0); printf("結果: %.5f\n", result); } return 0; } |
<< [K-Shoot MANIA v1.60] ユーザー定義エフェクトの作成方法 | ホーム | K-Shoot Editor v1.60 beta1 (ベータ版) >>
コメントの投稿